<template>
  <div>
    <h1>ref 和 $refs</h1>
    <h2 ref="title">这是一个h2</h2>
    <button @click="getH2">点我获取h2</button>
    <hr>
    <Demo ref="de" />
    <button @click="getDemo">获取demo组件</button>
  </div>
</template>

<script>
import Demo from './components/Demo'
export default {
  components:{Demo},
  data() {
    return {
    };
  },
  methods:{
    getH2(){
      console.log(this.$refs.title);
    },
    getDemo(){
      console.log(this.$refs.de)
      console.log(this.$refs.de.msg)
      this.$refs.de.demoFn()
    }

  }
};
</script>

<style lang="scss" scoped>

</style>